
/**
 * @param {Function} notifyMethod
 * @param {Object} notifyContext
 * @constructor
 */
function Observer (notifyMethod, notifyContext)
{
	this.setNotifyMethod(notifyMethod);
	this.setNotifyContext(notifyContext);
};

/**
 * @private
 * @type {Function}
 */
Observer.prototype.notifyMethod= null;

/**
 * @private
 * @type {Object}
 */
Observer.prototype.context= null;

/**
 * @return {void}
 */
Observer.prototype.setNotifyMethod= function (notifyMethod)
{
	this.notifyMethod= notifyMethod;
};

/**
 * @return {void}
 */
Observer.prototype.setNotifyContext=function (notifyContext)
{
	this.context= notifyContext;
};

/**
 * @private
 * @return {Function}
 */
Observer.prototype.getNotifyMethod= function ()
{
	return this.notifyMethod;
};

/**
 * @private
 * @return {Object}
 */
Observer.prototype.getNotifyContext= function ()
{
	return this.context;
};

/**
 * @param {Notification} notification
 * @return {void}
 */
Observer.prototype.notifyObserver= function (notification)
{
	// TODO confirm why apply, instead of call is being used
	// TODO confirm why private getters, rather than property accessors, are being used
	this.getNotifyMethod().apply(this.getNotifyContext(), [notification]);
	// this.notifyMethod.call(this.context, notification);
};

/**
 * @param {Object} object
 * @return {boolean}
 */
Observer.prototype.compareNotifyContext= function (object)
{
	return object === this.context;
};

